import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/index',
    name: 'index',
    component: () => import('../views/Index.vue'),
    children:[
      {
        path:"/home",
        name:"home",
        component:() => import('../views/index/Home.vue')
      },
      {
        path:"/tuan",
        name:"tuan",
        component:() => import('../views/index/Tuan.vue')
      },
      {
        path:"/order",
        name:"order",
        component:() => import('../views/index/Order.vue')
      },
      {
        path:"/mine",
        name:"mine",
        component:() => import('../views/index/Mine.vue')
      },
      {
        path:"/",
        redirect:"/home"
      }
    ]
  },
  // 重定向
  {
    path:"/",
    redirect:"/index"
  },
  // 404页面
  {
    path:"*",
    name:"no",
    component: () => import("@/views/NotFound.vue")
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
